package fairygui.editor.gui
{
   import com.greensock.TimelineMax;
   import com.greensock.TweenMax;
   import fairygui.editor.TimelinePanel;
   import fairygui.editor.gui.gear.EIAnimationGear;
   import fairygui.editor.gui.gear.EIColorGear;
   import fairygui.editor.utils.Utils;
   import fairygui.utils.GTimers;
   import flash.utils.getTimer;
   
   public class ETransition
   {
       
      
      public var owner:EGComponent;
      
      private var _name:String;
      
      private var _options:int;
      
      private var _items:Vector.<ETransitionItem>;
      
      private var _ownerBaseX:Number;
      
      private var _ownerBaseY:Number;
      
      private var _autoPlay:Boolean;
      
      private var _autoPlayRepeat:int;
      
      private var _autoPlayDelay:Number;
      
      public var timelinePanelHeight:Number;
      
      public const OPTION_IGNORE_DISPLAY_CONTROLLER:int = 1;
      
      public const OPTION_AUTO_STOP_DISABLED:int = 2;
      
      public const OPTION_AUTO_STOP_AT_END:int = 4;
      
      private var pending:Vector.<ETransitionItem>;
      
      private var _totalTimes:int;
      
      private var _totalTasks:int;
      
      private var _playing:Boolean;
      
      private var _onComplete:Function;
      
      private var _onCompleteParam:Object;
      
      public function ETransition(param1:EGComponent)
      {
         this.pending = new Vector.<ETransitionItem>();
         super();
         this.owner = param1;
         this._items = new Vector.<ETransitionItem>();
         this._ownerBaseX = 0;
         this._ownerBaseY = 0;
         this._autoPlayRepeat = 1;
         this._autoPlayDelay = 0;
      }
      
      public function get name() : String
      {
         return this._name;
      }
      
      public function set name(param1:String) : void
      {
         this._name = param1;
      }
      
      public function get options() : int
      {
         return this._options;
      }
      
      public function set options(param1:int) : void
      {
         this._options = param1;
      }
      
      public function get autoPlay() : Boolean
      {
         return this._autoPlay;
      }
      
      public function set autoPlay(param1:Boolean) : void
      {
         this._autoPlay = param1;
      }
      
      public function get autoPlayDelay() : Number
      {
         return this._autoPlayDelay;
      }
      
      public function set autoPlayDelay(param1:Number) : void
      {
         this._autoPlayDelay = param1;
      }
      
      public function get autoPlayRepeat() : int
      {
         return this._autoPlayRepeat;
      }
      
      public function set autoPlayRepeat(param1:int) : void
      {
         this._autoPlayRepeat = param1;
      }
      
      public function get ignoreDisplayController() : Boolean
      {
         return (this._options & this.OPTION_IGNORE_DISPLAY_CONTROLLER) != 0;
      }
      
      public function set ignoreDisplayController(param1:Boolean) : void
      {
         if(param1)
         {
            this._options = this._options | this.OPTION_IGNORE_DISPLAY_CONTROLLER;
         }
         else
         {
            this._options = this._options & ~this.OPTION_IGNORE_DISPLAY_CONTROLLER;
         }
      }
      
      public function get autoStop() : Boolean
      {
         return (this._options & this.OPTION_AUTO_STOP_DISABLED) == 0;
      }
      
      public function set autoStop(param1:Boolean) : void
      {
         if(!param1)
         {
            this._options = this._options | this.OPTION_AUTO_STOP_DISABLED;
         }
         else
         {
            this._options = this._options & ~this.OPTION_AUTO_STOP_DISABLED;
         }
      }
      
      public function get autoStopAtEnd() : Boolean
      {
         return (this._options & this.OPTION_AUTO_STOP_AT_END) != 0;
      }
      
      public function set autoStopAtEnd(param1:Boolean) : void
      {
         if(param1)
         {
            this._options = this._options | this.OPTION_AUTO_STOP_AT_END;
         }
         else
         {
            this._options = this._options & ~this.OPTION_AUTO_STOP_AT_END;
         }
      }
      
      public function dispose() : void
      {
      }
      
      public function get items() : Vector.<ETransitionItem>
      {
         return this._items;
      }
      
      public function arrangeItems() : void
      {
         var _loc3_:ETransitionItem = null;
         var _loc4_:int = 0;
         var _loc5_:ETransitionItem = null;
         this._items.sort(this.__compareItem);
         var _loc1_:int = this._items.length;
         var _loc2_:int = 0;
         while(_loc2_ < _loc1_)
         {
            _loc3_ = this._items[_loc2_];
            if(_loc3_.nextItem)
            {
               _loc3_.nextItem.prevItem = null;
               _loc3_.nextItem = null;
            }
            if(_loc3_.tween)
            {
               _loc4_ = _loc2_ + 1;
               while(_loc4_ < _loc1_)
               {
                  _loc5_ = this._items[_loc4_];
                  if(_loc5_.targetId == _loc3_.targetId && _loc5_.type == _loc3_.type)
                  {
                     _loc3_.nextItem = _loc5_;
                     _loc5_.prevItem = _loc3_;
                     break;
                  }
                  _loc4_++;
               }
            }
            _loc2_++;
         }
      }
      
      private function __compareItem(param1:ETransitionItem, param2:ETransitionItem) : int
      {
         if(param1.frame == param2.frame)
         {
            if(param1.type == "Pivot")
            {
               return -1;
            }
            if(param2.type == "Pivot")
            {
               return 1;
            }
            return param1.type.localeCompare(param2.type);
         }
         return param1.frame - param2.frame;
      }
      
      public function createItem(param1:String, param2:String, param3:int) : ETransitionItem
      {
         var _loc4_:ETransitionItem = new ETransitionItem(this);
         _loc4_.targetId = param1;
         _loc4_.type = param2;
         _loc4_.frame = param3;
         this.udpateValueFromTarget(_loc4_);
         this._items.push(_loc4_);
         this.arrangeItems();
         return _loc4_;
      }
      
      private function udpateValueFromTarget(param1:ETransitionItem) : void
      {
         var _loc3_:EGObject = null;
         var _loc2_:ETransitionValue = param1.value;
         if(param1.targetId)
         {
            _loc3_ = this.owner.getChildById(param1.targetId);
         }
         else
         {
            _loc3_ = this.owner;
         }
         switch(param1.type)
         {
            case "XY":
               _loc2_.a = _loc3_.x;
               _loc2_.b = _loc3_.y;
               break;
            case "Size":
               _loc2_.a = _loc3_.width;
               _loc2_.b = _loc3_.height;
               break;
            case "Pivot":
               _loc2_.a = _loc3_.pivotX;
               _loc2_.b = _loc3_.pivotY;
               break;
            case "Alpha":
               _loc2_.alpha = _loc3_.alpha;
               break;
            case "Rotation":
               _loc2_.rotation = _loc3_.rotation;
               break;
            case "Scale":
               _loc2_.a = _loc3_.scaleX;
               _loc2_.b = _loc3_.scaleY;
               break;
            case "Skew":
               _loc2_.a = _loc3_.skewX;
               _loc2_.b = _loc3_.skewY;
               break;
            case "Color":
               _loc2_.color = EIColorGear(_loc3_).color;
               break;
            case "Animation":
               _loc2_.frame = EIAnimationGear(_loc3_).frame;
               _loc2_.playing = EIAnimationGear(_loc3_).playing;
               break;
            case "Sound":
               break;
            case "Controller":
               break;
            case "Shake":
               _loc2_.shakeAmplitude = 3;
               _loc2_.shakePeriod = 0.5;
               break;
            case "Visible":
               _loc2_.visible = _loc3_.visible;
               break;
            case "ColorFilter":
               _loc2_.filter_cb = _loc3_.filter_cb;
               _loc2_.filter_cc = _loc3_.filter_cc;
               _loc2_.filter_ch = _loc3_.filter_ch;
               _loc2_.filter_cs = _loc3_.filter_cs;
         }
      }
      
      public function findCurItem(param1:String, param2:String) : ETransitionItem
      {
         var _loc3_:int = this.owner.pkg.project.editorWindow.mainPanel.editPanel.timelinePanel.head;
         return this.findItem(_loc3_,param1,param2);
      }
      
      public function findItem(param1:int, param2:String, param3:String) : ETransitionItem
      {
         return this.findItem2(param1,param2,param3,this._items);
      }
      
      public function findItem2(param1:int, param2:String, param3:String, param4:Vector.<ETransitionItem>) : ETransitionItem
      {
         var _loc7_:ETransitionItem = null;
         var _loc5_:int = param4.length;
         var _loc6_:int = 0;
         while(_loc6_ < _loc5_)
         {
            _loc7_ = param4[_loc6_];
            if(_loc7_.type == param3 && _loc7_.targetId == param2 && _loc7_.frame == param1)
            {
               return _loc7_;
            }
            _loc6_++;
         }
         return null;
      }
      
      public function addItem(param1:ETransitionItem) : void
      {
         this._items.push(param1);
         this.arrangeItems();
      }
      
      public function addItems(param1:Array) : void
      {
         var _loc2_:ETransitionItem = null;
         for each(_loc2_ in param1)
         {
            this._items.push(_loc2_);
         }
         this.arrangeItems();
      }
      
      public function deleteItem(param1:ETransitionItem) : void
      {
         var _loc2_:int = this._items.indexOf(param1);
         this._items.splice(_loc2_,1);
         this.arrangeItems();
      }
      
      public function deleteItems(param1:String, param2:String) : Array
      {
         var _loc6_:ETransitionItem = null;
         var _loc3_:Array = [];
         var _loc4_:int = this._items.length;
         var _loc5_:int = 0;
         while(_loc5_ < _loc4_)
         {
            _loc6_ = this._items[_loc5_];
            if(_loc6_.type == param2 && _loc6_.targetId == param1)
            {
               this._items.splice(_loc5_,1);
               _loc3_.push(_loc6_);
               _loc4_--;
            }
            else
            {
               _loc5_++;
            }
         }
         this.arrangeItems();
         return _loc3_;
      }
      
      public function copyItems(param1:String, param2:String) : XML
      {
         var _loc7_:ETransitionItem = null;
         var _loc3_:int = this._items.length;
         var _loc4_:Vector.<ETransitionItem> = new Vector.<ETransitionItem>();
         var _loc5_:int = 0;
         while(_loc5_ < _loc3_)
         {
            _loc7_ = this._items[_loc5_];
            if(_loc7_.type == param2 && _loc7_.targetId == param1)
            {
               _loc4_.push(_loc7_);
            }
            _loc5_++;
         }
         var _loc6_:XML = <transition/>;
         this.serializeItems(_loc4_,_loc6_,false);
         return _loc6_;
      }
      
      public function pasteItems(param1:XML, param2:String, param3:String) : void
      {
         var _loc7_:XML = null;
         var _loc8_:ETransitionItem = null;
         var _loc4_:int = this._items.length;
         var _loc5_:int = 0;
         while(_loc5_ < _loc4_)
         {
            _loc8_ = this._items[_loc5_];
            if(_loc8_.type == param3 && _loc8_.targetId == param2)
            {
               this._items.splice(_loc5_,1);
               _loc4_--;
            }
            else
            {
               _loc5_++;
            }
         }
         var _loc6_:XMLList = param1.item;
         for each(_loc7_ in _loc6_)
         {
            _loc7_.@target = param2;
            _loc7_.@type = param3;
         }
         this.addItemsFromXML(param1);
         this._items.sort(this.__compareItem);
      }
      
      public function setProperty(param1:String, param2:*) : *
      {
         var _loc3_:* = undefined;
         var _loc4_:* = undefined;
         _loc3_ = this[param1];
         if(Utils.equalText(param2,_loc3_))
         {
            return _loc3_;
         }
         this[param1] = param2;
         _loc4_ = this[param1];
         if(!Utils.equalText(_loc4_,_loc3_))
         {
            this.owner.pkg.project.editorWindow.activeComDocument.actionHistory.action_transitionSet(param1,_loc3_,_loc4_);
            if(param1 == "name")
            {
               this.owner.pkg.project.editorWindow.mainPanel.editPanel.updateTransitionListPanel();
            }
         }
         return _loc4_;
      }
      
      public function setItemProperty(param1:ETransitionItem, param2:String, param3:*) : *
      {
         var _loc4_:* = undefined;
         var _loc5_:* = undefined;
         _loc4_ = param1[param2];
         if(Utils.equalText(param3,_loc4_))
         {
            return _loc4_;
         }
         param1[param2] = param3;
         _loc5_ = param1[param2];
         if(!Utils.equalText(_loc5_,_loc4_))
         {
            this.owner.pkg.project.editorWindow.activeComDocument.actionHistory.action_transItemSet(param1,param2,_loc4_,_loc5_);
         }
         return _loc5_;
      }
      
      public function getAllowXChanged(param1:String) : Boolean
      {
         var _loc2_:int = this.owner.pkg.project.editorWindow.mainPanel.editPanel.timelinePanel.head;
         var _loc3_:ETransitionItem = this.findItem(_loc2_,param1,"XY");
         if(_loc3_ != null)
         {
            return _loc3_.value.aEnabled;
         }
         return false;
      }
      
      public function getAllowSizeChanged(param1:String) : Boolean
      {
         var _loc2_:int = this.owner.pkg.project.editorWindow.mainPanel.editPanel.timelinePanel.head;
         return this.findItem(_loc2_,param1,"Size") != null;
      }
      
      public function updateFromRelations(param1:String, param2:Number, param3:Number) : void
      {
         var _loc6_:ETransitionItem = null;
         var _loc4_:int = this._items.length;
         if(_loc4_ == 0)
         {
            return;
         }
         var _loc5_:int = 0;
         while(_loc5_ < _loc4_)
         {
            _loc6_ = this._items[_loc5_];
            if(_loc6_.type == "XY" && _loc6_.targetId == param1)
            {
               _loc6_.value.a = _loc6_.value.a + param2;
               _loc6_.value.b = _loc6_.value.b + param3;
            }
            _loc5_++;
         }
      }
      
      public function setCurFrame(param1:int) : void
      {
         var _loc4_:ETransitionItem = null;
         var _loc5_:EGObject = null;
         var _loc6_:Object = null;
         var _loc7_:Number = NaN;
         var _loc8_:Number = NaN;
         var _loc9_:TimelineMax = null;
         this.owner.pkg.project.editorWindow.mainPanel.propsPanelList.propsTransitionFrame.lockUpdate = true;
         this.owner.readSnapshot(false);
         this.pending.length = 0;
         var _loc2_:int = this._items.length;
         var _loc3_:int = 0;
         for(; _loc3_ < _loc2_; _loc3_++)
         {
            _loc4_ = this._items[_loc3_];
            if(_loc4_.valid)
            {
               if(_loc4_.frame > param1)
               {
                  break;
               }
               if(_loc4_.frame == param1)
               {
                  this.applyValue(_loc4_,_loc4_.value,false);
               }
               else if(_loc4_.tween)
               {
                  if(_loc4_.nextItem == null)
                  {
                     this.applyValue(_loc4_,_loc4_.value,false);
                  }
                  else
                  {
                     if(_loc4_.nextItem.frame <= param1)
                     {
                        continue;
                     }
                     this.pending.push(_loc4_);
                  }
               }
               else
               {
                  this.applyValue(_loc4_,_loc4_.value,false);
               }
            }
         }
         if(this.pending.length > 0)
         {
            for each(_loc4_ in this.pending)
            {
               if(_loc4_.targetId)
               {
                  _loc5_ = this.owner.getChildById(_loc4_.targetId);
               }
               else
               {
                  _loc5_ = this.owner;
               }
               switch(_loc4_.type)
               {
                  case "XY":
                     _loc4_.tweenValue.a = !!_loc4_.value.aEnabled?Number(_loc4_.value.a):Number(_loc5_.x);
                     _loc4_.tweenValue.b = !!_loc4_.value.bEnabled?Number(_loc4_.value.b):Number(_loc5_.y);
                     _loc6_ = {"ease":_loc4_.ease};
                     _loc6_.a = !!_loc4_.nextItem.value.aEnabled?_loc4_.nextItem.value.a:_loc4_.tweenValue.a;
                     _loc6_.b = !!_loc4_.nextItem.value.bEnabled?_loc4_.nextItem.value.b:_loc4_.tweenValue.b;
                     break;
                  case "Size":
                     _loc4_.tweenValue.a = !!_loc4_.value.aEnabled?Number(_loc4_.value.a):Number(_loc5_.width);
                     _loc4_.tweenValue.b = !!_loc4_.value.bEnabled?Number(_loc4_.value.b):Number(_loc5_.height);
                     _loc6_ = {"ease":_loc4_.ease};
                     _loc6_.a = !!_loc4_.nextItem.value.aEnabled?_loc4_.nextItem.value.a:_loc4_.tweenValue.a;
                     _loc6_.b = !!_loc4_.nextItem.value.bEnabled?_loc4_.nextItem.value.b:_loc4_.tweenValue.b;
                     break;
                  case "Scale":
                  case "Skew":
                     _loc4_.tweenValue.a = _loc4_.value.a;
                     _loc4_.tweenValue.b = _loc4_.value.b;
                     _loc6_ = {"ease":_loc4_.ease};
                     _loc6_.a = _loc4_.nextItem.value.a;
                     _loc6_.b = _loc4_.nextItem.value.b;
                     break;
                  case "Alpha":
                     _loc4_.tweenValue.alpha = _loc4_.value.alpha;
                     _loc6_ = {
                        "alpha":_loc4_.nextItem.value.alpha,
                        "ease":_loc4_.ease
                     };
                     break;
                  case "Rotation":
                     _loc4_.tweenValue.rotation = _loc4_.value.rotation;
                     _loc6_ = {
                        "rotation":_loc4_.nextItem.value.rotation,
                        "ease":_loc4_.ease
                     };
                     break;
                  case "Color":
                     _loc4_.tweenValue.color = _loc4_.value.color;
                     _loc6_ = {
                        "hexColors":{"color":_loc4_.nextItem.value.color},
                        "ease":_loc4_.ease
                     };
                     break;
                  case "ColorFilter":
                     _loc4_.tweenValue.filter_cb = _loc4_.value.filter_cb;
                     _loc4_.tweenValue.filter_cc = _loc4_.value.filter_cc;
                     _loc4_.tweenValue.filter_ch = _loc4_.value.filter_ch;
                     _loc4_.tweenValue.filter_cs = _loc4_.value.filter_cs;
                     _loc6_ = {
                        "filter_cb":_loc4_.nextItem.value.filter_cb,
                        "filter_cb":_loc4_.nextItem.value.filter_cc,
                        "filter_cb":_loc4_.nextItem.value.filter_ch,
                        "filter_cb":_loc4_.nextItem.value.filter_cs,
                        "ease":_loc4_.ease
                     };
               }
               if(_loc6_ != null)
               {
                  _loc7_ = (_loc4_.nextItem.frame - _loc4_.frame) / TimelinePanel.FRAME_RATE;
                  _loc8_ = (param1 - _loc4_.frame) / TimelinePanel.FRAME_RATE;
                  if(_loc4_.throughPoints.length > 0)
                  {
                     _loc6_.bezierThrough = _loc4_.throughPoints.concat([{
                        "a":_loc6_.a,
                        "b":_loc6_.b
                     }]);
                  }
                  if(_loc4_.repeat != 0)
                  {
                     if(_loc4_.repeat == -1)
                     {
                        _loc6_.repeat = int.MAX_VALUE;
                     }
                     else
                     {
                        _loc6_.repeat = _loc4_.repeat;
                     }
                  }
                  if(_loc4_.yoyo)
                  {
                     _loc6_.yoyo = _loc4_.yoyo;
                  }
                  _loc9_ = new TimelineMax();
                  _loc9_.to(_loc4_.tweenValue,_loc7_,_loc6_);
                  _loc9_.seek(_loc8_);
                  _loc9_.kill(null,_loc4_.tweenValue);
                  this.applyValue(_loc4_,_loc4_.tweenValue,true);
               }
            }
         }
         this.owner.pkg.project.editorWindow.mainPanel.propsPanelList.propsTransitionFrame.lockUpdate = false;
      }
      
      private function applyValue(param1:ETransitionItem, param2:ETransitionValue, param3:Boolean) : void
      {
         var _loc5_:EGObject = null;
         var _loc6_:Number = NaN;
         var _loc7_:Number = NaN;
         var _loc8_:ETransition = null;
         var _loc4_:String = param1.type;
         if(param1.targetId)
         {
            _loc5_ = this.owner.getChildById(param1.targetId);
         }
         else
         {
            _loc5_ = this.owner;
         }
         if(_loc5_ != null)
         {
            _loc5_.gearLocked = true;
            switch(_loc4_)
            {
               case "XY":
                  if(_loc5_ == this.owner)
                  {
                     if(!param2.aEnabled)
                     {
                        _loc6_ = _loc5_.x;
                     }
                     else
                     {
                        _loc6_ = param2.a + this._ownerBaseX;
                     }
                     if(!param2.bEnabled)
                     {
                        _loc7_ = _loc5_.y;
                     }
                     else
                     {
                        _loc7_ = param2.b + this._ownerBaseY;
                     }
                     _loc5_.setXY(_loc6_,_loc7_);
                  }
                  else
                  {
                     if(!param2.aEnabled)
                     {
                        param2.a = _loc5_.x;
                     }
                     if(!param2.bEnabled)
                     {
                        param2.b = _loc5_.y;
                     }
                     _loc5_.setXY(param2.a,param2.b);
                  }
                  break;
               case "Size":
                  if(!param2.aEnabled)
                  {
                     param2.a = _loc5_.width;
                  }
                  if(!param2.bEnabled)
                  {
                     param2.b = _loc5_.height;
                  }
                  _loc5_.setSize(param2.a,param2.b);
                  break;
               case "Pivot":
                  _loc5_.setPivot(param2.a,param2.b);
                  break;
               case "Alpha":
                  _loc5_.alpha = param2.alpha;
                  break;
               case "Rotation":
                  _loc5_.rotation = param2.rotation;
                  break;
               case "Scale":
                  _loc5_.setScale(param2.a,param2.b);
                  break;
               case "Skew":
                  _loc5_.setSkew(param2.a,param2.b);
                  break;
               case "Color":
                  EIColorGear(_loc5_).color = param2.color;
                  break;
               case "Animation":
                  if(!param2.aEnabled)
                  {
                     param2.frame = EIAnimationGear(_loc5_).frame;
                  }
                  EIAnimationGear(_loc5_).frame = param2.frame;
                  EIAnimationGear(_loc5_).playing = param2.playing;
                  break;
               case "Visible":
                  _loc5_.visible = param2.visible;
                  break;
               case "Transition":
                  if(this.owner.editMode == 1)
                  {
                     _loc8_ = EGComponent(_loc5_).transitions.getItem(param2.transName);
                     if(_loc8_ != null)
                     {
                        if(param2.transTimes == 0)
                        {
                           _loc8_.stop(true);
                        }
                        else if(_loc8_.playing)
                        {
                           _loc8_._totalTimes = param2.transTimes == -1?int(int.MAX_VALUE):int(param2.transTimes);
                        }
                        else
                        {
                           param1.completed = false;
                           this._totalTasks++;
                           _loc8_.play(this.__tweenComplete,param1,param2.transTimes);
                        }
                     }
                  }
                  break;
               case "Sound":
                  if(this.owner.editMode == 1)
                  {
                     this.owner.pkg.project.editorWindow.playSound(param2.sound,param2.volume);
                  }
                  break;
               case "Shake":
                  if(this.owner.editMode == 1)
                  {
                     param1.completed = false;
                     this._totalTasks++;
                     param2.a = getTimer();
                     param2.b = param2.shakePeriod;
                     param2.c = 0;
                     param2.d = 0;
                     GTimers.inst.add(1,0,param1.__shake,this);
                  }
                  break;
               case "ColorFilter":
                  _loc5_.filter_cb = param2.filter_cb;
                  _loc5_.filter_cc = param2.filter_cc;
                  _loc5_.filter_ch = param2.filter_ch;
                  _loc5_.filter_cs = param2.filter_cs;
                  _loc5_.filter = "color";
            }
            _loc5_.gearLocked = false;
         }
      }
      
      public function validate() : void
      {
         var _loc3_:ETransitionItem = null;
         var _loc1_:int = this._items.length;
         var _loc2_:int = 0;
         while(_loc2_ < _loc1_)
         {
            _loc3_ = this._items[_loc2_];
            if(_loc3_.targetId)
            {
               _loc3_.valid = this.owner.getChildById(_loc3_.targetId) != null;
            }
            _loc2_++;
         }
      }
      
      public function addItemsFromXML(param1:XML) : void
      {
         var _loc6_:String = null;
         var _loc7_:XML = null;
         var _loc8_:int = 0;
         var _loc9_:ETransitionItem = null;
         var _loc10_:Object = null;
         var _loc11_:int = 0;
         var _loc12_:ETransitionValue = null;
         var _loc13_:ETransitionItem = null;
         var _loc2_:Vector.<ETransitionItem> = new Vector.<ETransitionItem>();
         var _loc3_:XMLList = param1.item;
         var _loc4_:Array = [];
         var _loc5_:int = 0;
         for each(_loc7_ in _loc3_)
         {
            _loc9_ = new ETransitionItem(this);
            _loc2_.push(_loc9_);
            _loc10_ = {};
//            _loc4_[_loc16_] = _loc10_;
            _loc6_ = _loc7_.@duration;
            _loc10_.duration = parseInt(_loc6_);
            _loc6_ = _loc7_.@time;
            _loc9_.frame = parseInt(_loc6_);
            _loc9_.type = _loc7_.@type;
            _loc9_.targetId = _loc7_.@target;
            _loc9_.tween = _loc7_.@tween == "true";
            _loc6_ = _loc7_.@repeat;
            if(_loc6_)
            {
               _loc9_.repeat = parseInt(_loc6_);
            }
            _loc9_.yoyo = _loc7_.@yoyo == "true";
            _loc9_.label = _loc7_.@label;
            _loc6_ = _loc7_.@label2;
            if(_loc6_)
            {
               _loc10_.label2 = _loc6_;
            }
            _loc6_ = _loc7_.@ease;
            if(_loc6_)
            {
               _loc11_ = _loc6_.indexOf(".");
               if(_loc11_ != -1)
               {
                  _loc9_.easeType = _loc6_.substr(0,_loc11_);
                  _loc9_.easeInOutType = _loc6_.substr(_loc11_ + 1);
               }
               else
               {
                  _loc9_.easeType = _loc6_;
               }
            }
            _loc6_ = _loc7_.@startValue;
            if(_loc6_)
            {
               _loc9_.value.decode(_loc9_.type,_loc6_);
            }
            else
            {
               _loc6_ = _loc7_.@value;
               if(_loc6_)
               {
                  _loc9_.value.decode(_loc9_.type,_loc6_);
               }
            }
            _loc6_ = _loc7_.@endValue;
            if(_loc6_)
            {
               _loc12_ = new ETransitionValue();
               _loc12_.decode(_loc9_.type,_loc6_);
               _loc10_.value = _loc12_;
            }
         }
         _loc8_ = _loc2_.length;
         _loc5_ = 0;
         while(_loc5_ < _loc8_)
         {
            _loc9_ = _loc2_[_loc5_];
            _loc10_ = _loc4_[_loc5_];
            if(_loc9_.tween && _loc10_.duration > 0)
            {
               _loc13_ = this.findItem2(_loc9_.frame + _loc10_.duration,_loc9_.targetId,_loc9_.type,_loc2_);
               if(_loc13_ == null)
               {
                  _loc13_ = new ETransitionItem(this);
                  _loc13_.frame = _loc9_.frame + _loc10_.duration;
                  _loc13_.type = _loc9_.type;
                  _loc13_.targetId = _loc9_.targetId;
                  _loc13_.value.assign(_loc10_.value);
                  _loc13_.tween = false;
                  _loc13_.label = _loc10_.label2;
                  _loc2_.push(_loc13_);
               }
               _loc9_.nextItem = _loc13_;
               _loc13_.prevItem = _loc9_;
            }
            _loc5_++;
         }
         for each(_loc9_ in _loc2_)
         {
            this._items.push(_loc9_);
         }
      }
      
      public function serializeItems(param1:Vector.<ETransitionItem>, param2:XML, param3:Boolean) : void
      {
         var _loc5_:ETransitionItem = null;
         var _loc7_:XML = null;
         var _loc8_:String = null;
         var _loc4_:int = param1.length;
         var _loc6_:int = 0;
         while(_loc6_ < _loc4_)
         {
            _loc5_ = param1[_loc6_];
            if(!(_loc5_.prevItem && !_loc5_.tween))
            {
               if(!(param3 && !_loc5_.valid))
               {
                  _loc7_ = <item/>;
                  _loc7_.@time = _loc5_.frame;
                  _loc7_.@type = _loc5_.type;
                  if(_loc5_.targetId)
                  {
                     _loc7_.@target = _loc5_.targetId;
                  }
                  if(_loc5_.label)
                  {
                     _loc7_.@label = _loc5_.label;
                  }
                  if(_loc5_.tween)
                  {
                     _loc7_.@tween = _loc5_.tween;
                     _loc7_.@startValue = _loc5_.value.encode(_loc5_.type);
                     if(_loc5_.nextItem)
                     {
                        _loc7_.@endValue = _loc5_.nextItem.value.encode(_loc5_.type);
                        _loc7_.@duration = _loc5_.nextItem.frame - _loc5_.frame;
                        if(_loc5_.nextItem.label)
                        {
                           _loc7_.@label2 = _loc5_.nextItem.label;
                        }
                     }
                     _loc8_ = _loc5_.easeName;
                     if(_loc8_ != "Quad.Out")
                     {
                        _loc7_.@ease = _loc8_;
                     }
                     if(_loc5_.repeat != 0)
                     {
                        _loc7_.@repeat = _loc5_.repeat;
                     }
                     if(_loc5_.yoyo)
                     {
                        _loc7_.@yoyo = _loc5_.yoyo;
                     }
                  }
                  else
                  {
                     _loc7_.@value = _loc5_.value.encode(_loc5_.type);
                  }
                  param2.appendChild(_loc7_);
               }
            }
            _loc6_++;
         }
      }
      
      public function fromXML(param1:XML) : void
      {
         var _loc2_:String = null;
         this._name = param1.@name;
         _loc2_ = param1.@options;
         if(_loc2_ != null)
         {
            this._options = parseInt(_loc2_);
         }
         else
         {
            this._options = 0;
         }
         this._autoPlay = param1.@autoPlay == "true";
         _loc2_ = param1.@autoPlayRepeat;
         if(_loc2_)
         {
            this._autoPlayRepeat = parseInt(_loc2_);
         }
         _loc2_ = param1.@autoPlayDelay;
         if(_loc2_)
         {
            this._autoPlayDelay = parseFloat(_loc2_);
         }
         this._items.length = 0;
         this.addItemsFromXML(param1);
         this._items.sort(this.__compareItem);
      }
      
      public function toXML(param1:Boolean) : XML
      {
         this.validate();
         var _loc2_:XML = <transition/>;
         _loc2_.@name = this._name;
         if(this._options != 0)
         {
            _loc2_.@options = this._options;
         }
         if(this._autoPlay)
         {
            _loc2_.@autoPlay = this._autoPlay;
         }
         if(this._autoPlayRepeat != 1)
         {
            _loc2_.@autoPlayRepeat = this._autoPlayRepeat;
         }
         if(this._autoPlayDelay != 0)
         {
            _loc2_.@autoPlayDelay = this._autoPlayDelay.toFixed(3);
         }
         this.serializeItems(this._items,_loc2_,param1);
         return _loc2_;
      }
      
      public function play(param1:Function = null, param2:Object = null, param3:int = 1, param4:Number = 0) : void
      {
         var _loc5_:int = 0;
         var _loc6_:int = 0;
         var _loc7_:ETransitionItem = null;
         var _loc8_:EGObject = null;
         this.stop();
         this.validate();
         if(param3 < 0)
         {
            param3 = int.MAX_VALUE;
         }
         else if(param3 == 0)
         {
            param3 = 1;
         }
         this._totalTimes = param3;
         this.internalPlay(param4);
         this._playing = this._totalTasks > 0;
         if(this._playing)
         {
            this._onComplete = param1;
            this._onCompleteParam = param2;
            if(this.owner.editMode == 1)
            {
               if(this._options & this.OPTION_IGNORE_DISPLAY_CONTROLLER)
               {
                  _loc5_ = this._items.length;
                  _loc6_ = 0;
                  while(_loc6_ < _loc5_)
                  {
                     _loc7_ = this._items[_loc6_];
                     if(_loc7_.valid)
                     {
                        if(_loc7_.targetId)
                        {
                           _loc8_ = this.owner.getChildById(_loc7_.targetId);
                           if(this.owner.editMode == 1)
                           {
                              _loc7_.displayLockToken = _loc8_.addDisplayLock();
                           }
                        }
                     }
                     _loc6_++;
                  }
               }
            }
         }
         else if(param1 != null)
         {
            if(param1.length > 0)
            {
               param1(param2);
            }
            else
            {
               param1();
            }
         }
      }
      
      public function get playing() : Boolean
      {
         return this._playing;
      }
      
      public function set repeat(param1:int) : void
      {
         if(param1 < 0)
         {
            param1 = int.MAX_VALUE;
         }
         else if(param1 == 0)
         {
            param1 = 1;
         }
         this._totalTimes = param1;
      }
      
      public function get repeat() : int
      {
         return this._totalTimes;
      }
      
      private function internalPlay(param1:Number = 0) : void
      {
         var _loc3_:Object = null;
         var _loc4_:Number = NaN;
         var _loc6_:ETransitionItem = null;
         var _loc7_:Number = NaN;
         this._ownerBaseX = this.owner.x;
         this._ownerBaseY = this.owner.y;
         this._totalTasks = 0;
         var _loc2_:int = this._items.length;
         var _loc5_:int = 0;
         while(_loc5_ < _loc2_)
         {
            _loc6_ = this._items[_loc5_];
            if(_loc6_.valid)
            {
               _loc4_ = param1 + _loc6_.frame / TimelinePanel.FRAME_RATE;
               if(_loc6_.tween)
               {
                  if(_loc6_.nextItem == null)
                  {
                     if(_loc6_.frame == 0)
                     {
                        this.applyValue(_loc6_,_loc6_.value,false);
                     }
                     else
                     {
                        this._totalTasks++;
                        _loc6_.completed = false;
                        _loc6_.tweener = TweenMax.delayedCall(_loc4_,this.delayCall,[_loc6_]);
                     }
                  }
                  else
                  {
                     _loc6_.completed = false;
                     this._totalTasks++;
                     _loc7_ = (_loc6_.nextItem.frame - _loc6_.frame) / TimelinePanel.FRAME_RATE;
                     switch(_loc6_.type)
                     {
                        case "XY":
                        case "Size":
                           if(_loc4_ == 0)
                           {
                              this.delayCall2(_loc6_);
                           }
                           else
                           {
                              _loc6_.tweener = TweenMax.delayedCall(_loc4_,this.delayCall2,[_loc6_]);
                           }
                           break;
                        case "Scale":
                        case "Skew":
                           _loc6_.tweenValue.a = _loc6_.value.a;
                           _loc6_.tweenValue.b = _loc6_.value.b;
                           _loc3_ = {
                              "a":_loc6_.nextItem.value.a,
                              "b":_loc6_.nextItem.value.b,
                              "ease":_loc6_.ease,
                              "onUpdate":this.__tweenUpdate,
                              "onUpdateParams":[_loc6_],
                              "onComplete":this.__tweenComplete,
                              "onCompleteParams":[_loc6_]
                           };
                           if(_loc4_ != 0)
                           {
                              _loc3_.delay = _loc4_;
                           }
                           else
                           {
                              this.applyValue(_loc6_,_loc6_.tweenValue,false);
                           }
                           if(_loc6_.repeat != 0)
                           {
                              if(_loc6_.repeat == -1)
                              {
                                 _loc3_.repeat = int.MAX_VALUE;
                              }
                              else
                              {
                                 _loc3_.repeat = _loc6_.repeat;
                              }
                           }
                           if(_loc6_.yoyo)
                           {
                              _loc3_.yoyo = _loc6_.yoyo;
                           }
                           _loc6_.tweener = TweenMax.to(_loc6_.tweenValue,_loc7_,_loc3_);
                           break;
                        case "Alpha":
                           _loc6_.tweenValue.alpha = _loc6_.value.alpha;
                           _loc3_ = {
                              "alpha":_loc6_.nextItem.value.alpha,
                              "ease":_loc6_.ease,
                              "onUpdate":this.__tweenUpdate,
                              "onUpdateParams":[_loc6_],
                              "onComplete":this.__tweenComplete,
                              "onCompleteParams":[_loc6_]
                           };
                           if(_loc4_ != 0)
                           {
                              _loc3_.delay = _loc4_;
                           }
                           else
                           {
                              this.applyValue(_loc6_,_loc6_.tweenValue,false);
                           }
                           if(_loc6_.repeat != 0)
                           {
                              if(_loc6_.repeat == -1)
                              {
                                 _loc3_.repeat = int.MAX_VALUE;
                              }
                              else
                              {
                                 _loc3_.repeat = _loc6_.repeat;
                              }
                           }
                           if(_loc6_.yoyo)
                           {
                              _loc3_.yoyo = _loc6_.yoyo;
                           }
                           _loc6_.tweener = TweenMax.to(_loc6_.tweenValue,_loc7_,_loc3_);
                           break;
                        case "Rotation":
                           _loc6_.tweenValue.rotation = _loc6_.value.rotation;
                           _loc3_ = {
                              "rotation":_loc6_.nextItem.value.rotation,
                              "ease":_loc6_.ease,
                              "onUpdate":this.__tweenUpdate,
                              "onUpdateParams":[_loc6_],
                              "onComplete":this.__tweenComplete,
                              "onCompleteParams":[_loc6_]
                           };
                           if(_loc4_ != 0)
                           {
                              _loc3_.delay = _loc4_;
                           }
                           else
                           {
                              this.applyValue(_loc6_,_loc6_.tweenValue,false);
                           }
                           if(_loc6_.repeat != 0)
                           {
                              if(_loc6_.repeat == -1)
                              {
                                 _loc3_.repeat = int.MAX_VALUE;
                              }
                              else
                              {
                                 _loc3_.repeat = _loc6_.repeat;
                              }
                           }
                           if(_loc6_.yoyo)
                           {
                              _loc3_.yoyo = _loc6_.yoyo;
                           }
                           _loc6_.tweener = TweenMax.to(_loc6_.tweenValue,_loc7_,_loc3_);
                           break;
                        case "Color":
                           _loc6_.tweenValue.color = _loc6_.value.color;
                           _loc3_ = {
                              "hexColors":{"color":_loc6_.nextItem.value.color},
                              "ease":_loc6_.ease,
                              "onUpdate":this.__tweenUpdate,
                              "onUpdateParams":[_loc6_],
                              "onComplete":this.__tweenComplete,
                              "onCompleteParams":[_loc6_]
                           };
                           if(_loc4_ != 0)
                           {
                              _loc3_.delay = _loc4_;
                           }
                           else
                           {
                              this.applyValue(_loc6_,_loc6_.tweenValue,false);
                           }
                           if(_loc6_.repeat != 0)
                           {
                              if(_loc6_.repeat == -1)
                              {
                                 _loc3_.repeat = int.MAX_VALUE;
                              }
                              else
                              {
                                 _loc3_.repeat = _loc6_.repeat;
                              }
                           }
                           if(_loc6_.yoyo)
                           {
                              _loc3_.yoyo = _loc6_.yoyo;
                           }
                           _loc6_.tweener = TweenMax.to(_loc6_.tweenValue,_loc7_,_loc3_);
                           break;
                        case "ColorFilter":
                           _loc6_.tweenValue.filter_cb = _loc6_.value.filter_cb;
                           _loc6_.tweenValue.filter_cc = _loc6_.value.filter_cc;
                           _loc6_.tweenValue.filter_ch = _loc6_.value.filter_ch;
                           _loc6_.tweenValue.filter_cs = _loc6_.value.filter_cs;
                           _loc3_ = {
                              "filter_cb":_loc6_.nextItem.value.filter_cb,
                              "filter_cc":_loc6_.nextItem.value.filter_cc,
                              "filter_ch":_loc6_.nextItem.value.filter_ch,
                              "filter_cs":_loc6_.nextItem.value.filter_cs,
                              "ease":_loc6_.ease,
                              "onUpdate":this.__tweenUpdate,
                              "onUpdateParams":[_loc6_],
                              "onComplete":this.__tweenComplete,
                              "onCompleteParams":[_loc6_]
                           };
                           if(_loc4_ != 0)
                           {
                              _loc3_.delay = _loc4_;
                           }
                           else
                           {
                              this.applyValue(_loc6_,_loc6_.tweenValue,false);
                           }
                           if(_loc6_.repeat != 0)
                           {
                              if(_loc6_.repeat == -1)
                              {
                                 _loc3_.repeat = int.MAX_VALUE;
                              }
                              else
                              {
                                 _loc3_.repeat = _loc6_.repeat;
                              }
                           }
                           if(_loc6_.yoyo)
                           {
                              _loc3_.yoyo = _loc6_.yoyo;
                           }
                           _loc6_.tweener = TweenMax.to(_loc6_.tweenValue,_loc7_,_loc3_);
                           break;
                        default:
                           _loc6_.completed = true;
                           this._totalTasks--;
                     }
                  }
               }
               else if(_loc6_.prevItem == null)
               {
                  if(_loc4_ == 0)
                  {
                     this.applyValue(_loc6_,_loc6_.value,false);
                  }
                  else
                  {
                     _loc6_.completed = false;
                     this._totalTasks++;
                     _loc6_.tweener = TweenMax.delayedCall(_loc4_,this.delayCall,[_loc6_]);
                  }
               }
            }
            _loc5_++;
         }
      }
      
      public function stop(param1:Boolean = false) : void
      {
         var _loc2_:Function = null;
         var _loc3_:Object = null;
         var _loc4_:int = 0;
         var _loc5_:int = 0;
         var _loc6_:ETransitionItem = null;
         var _loc7_:EGObject = null;
         var _loc8_:EGComponent = null;
         var _loc9_:ETransition = null;
         if(this._playing)
         {
            this._playing = false;
            this._totalTasks = 0;
            this._totalTimes = 0;
            _loc2_ = this._onComplete;
            _loc3_ = this._onCompleteParam;
            this._onComplete = null;
            this._onCompleteParam = null;
            _loc4_ = this._items.length;
            _loc5_ = 0;
            while(_loc5_ < _loc4_)
            {
               _loc6_ = this._items[_loc5_];
               if(_loc6_.valid)
               {
                  if(_loc6_.targetId)
                  {
                     _loc7_ = this.owner.getChildById(_loc6_.targetId);
                     if(_loc6_.displayLockToken != 0)
                     {
                        _loc7_.releaseDisplayLock(_loc6_.displayLockToken);
                        _loc6_.displayLockToken = 0;
                     }
                  }
                  else
                  {
                     _loc7_ = this.owner;
                  }
                  if(!_loc6_.completed)
                  {
                     if(_loc6_.type == "Transition")
                     {
                        _loc8_ = EGComponent(_loc7_);
                        _loc9_ = _loc8_.transitions.getItem(_loc6_.value.transName);
                        if(_loc9_ != null)
                        {
                           _loc9_.stop(false);
                        }
                     }
                     else if(_loc6_.type == "Shake")
                     {
                        GTimers.inst.remove(_loc6_.__shake);
                        _loc7_.gearLocked = true;
                        _loc7_.setXY(_loc7_.x - _loc6_.value.c,_loc7_.y - _loc6_.value.d);
                        _loc7_.gearLocked = false;
                     }
                     else if(_loc6_.prevItem == null)
                     {
                        if(_loc6_.tweener != null)
                        {
                           _loc6_.tweener.kill();
                           _loc6_.tweener = null;
                        }
                        if(_loc6_.tween && _loc6_.nextItem != null && (!_loc6_.yoyo || _loc6_.repeat % 2 == 0))
                        {
                           this.applyValue(_loc6_,_loc6_.nextItem.value,false);
                        }
                        else if(_loc6_.type != "Sound")
                        {
                           this.applyValue(_loc6_,_loc6_.value,false);
                        }
                     }
                  }
               }
               _loc5_++;
            }
            if(param1 && _loc2_ != null)
            {
               if(_loc2_.length > 0)
               {
                  _loc2_(_loc3_);
               }
               else
               {
                  _loc2_();
               }
            }
         }
      }
      
      private function delayCall(param1:ETransitionItem) : void
      {
         param1.tweener = null;
         param1.completed = true;
         this._totalTasks--;
         this.applyValue(param1,param1.value,false);
         this.checkAllComplete();
      }
      
      public function __shake(param1:ETransitionItem) : void
      {
         var _loc5_:EGObject = null;
         var _loc2_:Number = Math.ceil(param1.value.shakeAmplitude * param1.value.b / param1.value.shakePeriod);
         var _loc3_:Number = (Math.random() * 2 - 1) * _loc2_;
         var _loc4_:Number = (Math.random() * 2 - 1) * _loc2_;
         _loc3_ = _loc3_ > 0?Number(Math.ceil(_loc3_)):Number(Math.floor(_loc3_));
         _loc4_ = _loc4_ > 0?Number(Math.ceil(_loc4_)):Number(Math.floor(_loc4_));
         if(param1.targetId)
         {
            _loc5_ = this.owner.getChildById(param1.targetId);
         }
         else
         {
            _loc5_ = this.owner;
         }
         if(_loc5_ != null)
         {
            _loc5_.gearLocked = true;
            _loc5_.setXY(_loc5_.x - param1.value.c + _loc3_,_loc5_.y - param1.value.d + _loc4_);
            _loc5_.gearLocked = false;
            param1.value.c = _loc3_;
            param1.value.d = _loc4_;
         }
         var _loc6_:int = getTimer();
         param1.value.b = param1.value.b - (_loc6_ - param1.value.a) / 1000;
         param1.value.a = _loc6_;
         if(param1.value.b <= 0)
         {
            if(_loc5_ != null)
            {
               _loc5_.gearLocked = true;
               _loc5_.setXY(_loc5_.x - param1.value.c,_loc5_.y - param1.value.d);
               _loc5_.gearLocked = false;
            }
            param1.completed = true;
            this._totalTasks--;
            GTimers.inst.remove(param1.__shake);
            this.checkAllComplete();
         }
      }
      
      private function delayCall2(param1:ETransitionItem) : void
      {
         var _loc2_:EGObject = null;
         if(param1.targetId)
         {
            _loc2_ = this.owner.getChildById(param1.targetId);
         }
         else
         {
            _loc2_ = this.owner;
         }
         if(param1.type == "XY")
         {
            param1.tweenValue.a = !!param1.value.aEnabled?Number(param1.value.a):Number(_loc2_.x);
            param1.tweenValue.b = !!param1.value.bEnabled?Number(param1.value.b):Number(_loc2_.y);
         }
         else
         {
            param1.tweenValue.a = !!param1.value.aEnabled?Number(param1.value.a):Number(_loc2_.width);
            param1.tweenValue.b = !!param1.value.bEnabled?Number(param1.value.b):Number(_loc2_.height);
         }
         var _loc3_:Object = {
            "ease":param1.ease,
            "onUpdate":this.__tweenUpdate,
            "onUpdateParams":[param1],
            "onComplete":this.__tweenComplete,
            "onCompleteParams":[param1]
         };
         _loc3_.a = !!param1.nextItem.value.aEnabled?param1.nextItem.value.a:param1.tweenValue.a;
         _loc3_.b = !!param1.nextItem.value.bEnabled?param1.nextItem.value.b:param1.tweenValue.b;
         if(param1.throughPoints.length > 0)
         {
            _loc3_.bezierThrough = param1.throughPoints.concat([{
               "a":_loc3_.a,
               "b":_loc3_.b
            }]);
         }
         if(param1.repeat != 0)
         {
            if(param1.repeat == -1)
            {
               _loc3_.repeat = int.MAX_VALUE;
            }
            else
            {
               _loc3_.repeat = param1.repeat;
            }
         }
         if(param1.yoyo)
         {
            _loc3_.yoyo = param1.yoyo;
         }
         var _loc4_:Number = (param1.nextItem.frame - param1.frame) / TimelinePanel.FRAME_RATE;
         this.applyValue(param1,param1.tweenValue,false);
         param1.tweener = TweenMax.to(param1.tweenValue,_loc4_,_loc3_);
      }
      
      private function __tweenUpdate(param1:ETransitionItem) : void
      {
         this.applyValue(param1,param1.tweenValue,true);
      }
      
      private function __tweenComplete(param1:ETransitionItem) : void
      {
         param1.tweener = null;
         param1.completed = true;
         this._totalTasks--;
         this.checkAllComplete();
      }
      
      private function checkAllComplete() : void
      {
         var _loc1_:int = 0;
         var _loc2_:int = 0;
         var _loc3_:ETransitionItem = null;
         var _loc4_:EGObject = null;
         var _loc5_:Function = null;
         var _loc6_:Object = null;
         if(this._playing && this._totalTasks == 0)
         {
            if(this._totalTimes < 0)
            {
               this.internalPlay();
            }
            else
            {
               this._totalTimes--;
               if(this._totalTimes > 0)
               {
                  this.internalPlay();
               }
               else
               {
                  this._playing = false;
                  if(this.owner.editMode == 1)
                  {
                     if(this._options & this.OPTION_IGNORE_DISPLAY_CONTROLLER)
                     {
                        _loc1_ = this._items.length;
                        _loc2_ = 0;
                        while(_loc2_ < _loc1_)
                        {
                           _loc3_ = this._items[_loc2_];
                           if(_loc3_.displayLockToken != 0)
                           {
                              if(_loc3_.valid)
                              {
                                 if(_loc3_.targetId)
                                 {
                                    _loc4_ = this.owner.getChildById(_loc3_.targetId);
                                    if(_loc4_)
                                    {
                                       _loc4_.releaseDisplayLock(_loc3_.displayLockToken);
                                    }
                                 }
                              }
                              _loc3_.displayLockToken = 0;
                           }
                           _loc2_++;
                        }
                     }
                  }
                  if(this._onComplete != null)
                  {
                     _loc5_ = this._onComplete;
                     _loc6_ = this._onCompleteParam;
                     this._onComplete = null;
                     this._onCompleteParam = null;
                     if(_loc5_.length > 0)
                     {
                        _loc5_(_loc6_);
                     }
                     else
                     {
                        _loc5_();
                     }
                  }
               }
            }
         }
      }
   }
}
